package org.vincen.helloworld.operatingsystem;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Windows7 {
	
	public static void main(String[] args) {
		String os = System.getProperty("os.name");
		System.out.println(os);
		if (os != null && os.startsWith("Windows")) {
			String command = "cmd.exe /c systeminfo";
			Process p = null;
			try {
				p = Runtime.getRuntime().exec(command);
			} catch (IOException e) {
				e.printStackTrace();
			}
			BufferedReader reader = new BufferedReader(new InputStreamReader(
					p.getInputStream()));
			boolean flag = true;
			while (flag) {
				try {
					if (reader.readLine() == null) {
						flag = false;
					} else {
						System.out.println(reader.readLine());
					}
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}
	}
}
